﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Item : MonoBehaviour
{
    public int ID;
    public int Quality;
    public int Price;
    public string ItemName;
    private UILabel lab_name;
    private void Start()
    {
        lab_name = this.GetComponentInChildren<UILabel>();
        ItemInit("test"+Random.Range(1,100));
    }

    public void ItemInit(string name)
    {
        ID = Random.Range(1, 100);
        Quality = Random.Range(1,100);
        Price = Random.Range(1, 100);
        ItemName = name;
        lab_name.text = ItemName;
    }

    public void SetData(Item item)
    {
        ID = item.ID;
        Quality = item.Quality;
        Price = item.Price;
        ItemName = item.ItemName;
        lab_name.text = "[00ee00]"+ItemName+"[-]"+"[ff0000]$"+Price+"[-]";
    }
    void OnClick()
    {
        Debug.Log("OnClick");
    }

    void OnHover()
    {
        Debug.Log("onHover");
    }
}
